import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'

export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src')
    }
  },
  server: {
    host: '0.0.0.0', // 允许外部访问
    port: 8400,
    open: false, // 服务器环境不需要自动打开浏览器
    proxy: {
      '/api': {
        target: 'http://143.64.120.39:8000',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      }
    }
  },
  preview: {
    host: '0.0.0.0', // 允许外部访问
    port: 8400,
    open: false // 服务器环境不需要自动打开浏览器
  }
})

